window.operateEvents
'click .show': function (e, value, row, index) {//顯示單筆
alert('查詢');//
}
- 利用 google.script.run.withSuccessHandler(onSuccess).show_custom(row.sn);
'click .show': function (e, value, row, index) {//顯示單筆
google.script.run.withSuccessHandler(onSuccess).show_custom(row.sn);
setIdAttribute('main-content','d-none');//關閉主畫面
setIdAttribute('show','my-5'); //開啟等待畫面
}
- 後台程式 show_custom()
/* ==========================
客戶 顯示單筆函式
============================*/
function show_custom(sn) {
let sheet = 'day2';
let stru = get_stru_custom();
let row = get_row_by_sn(sn, sheet);
let content = '';
if (row) {
content += Sheet.render('show_custom', { stru: stru, row: row }, '');
}
return content;
}
- 前台顯示畫面 onSuccess(html)
/*===============================
取得資料成功,回傳
===============================*/
function onSuccess(data) {
setIdAttribute('main-content',''); //開啟主畫面
setIdAttribute('show','d-none');//關閉等待畫面
Swal.fire({
width: '95%',
html: data,
showCloseButton: true,
showCancelButton: false,
showConfirmButton: false
});
}